Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pacote

Package Overview
Dependencies
Maintainers
7
Versions
223
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pacote

JavaScript package downloader

  • 9.5.12
  • v9-legacy
  • Source
  • npm
  • Socket score

Version published
Maintainers
7
Created

What is pacote?

Pacote is a Node.js library that provides a set of utilities for fetching and extracting npm packages. It is designed to handle various types of package sources, including the npm registry, tarballs, git repositories, and local directories. Pacote is often used internally by npm and other tools to manage package dependencies.

What are pacote's main functionalities?

Fetch Package Metadata

This feature allows you to fetch the metadata of a package from the npm registry. The code sample demonstrates how to fetch and log the metadata for the 'lodash' package.

const pacote = require('pacote');

async function fetchMetadata(packageName) {
  const manifest = await pacote.manifest(packageName);
  console.log(manifest);
}

fetchMetadata('lodash');

Extract Package Tarball

This feature allows you to fetch and extract the tarball of a package. The code sample demonstrates how to fetch the tarball for the 'lodash' package and save it to a file named 'lodash.tgz'.

const pacote = require('pacote');
const fs = require('fs');

async function extractTarball(packageName, destination) {
  const tarballStream = await pacote.tarball.stream(packageName);
  tarballStream.pipe(fs.createWriteStream(destination));
}

extractTarball('lodash', './lodash.tgz');

Fetch Package from Git Repository

This feature allows you to fetch a package directly from a git repository. The code sample demonstrates how to fetch and log the metadata for the 'lodash' package from its GitHub repository.

const pacote = require('pacote');

async function fetchFromGit(repoUrl) {
  const manifest = await pacote.manifest(repoUrl);
  console.log(manifest);
}

fetchFromGit('https://github.com/lodash/lodash.git');

Other packages similar to pacote

Keywords

FAQs

Package last updated on 06 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc